

#include "CTNodeWin.h"
#include "log.h"


CCTNodeWin::CCTNodeWin()
{
}

CCTNodeWin::~CCTNodeWin()
{
}

void CCTNodeWin::InitImageLists(void)
{
    HIMAGELIST himl;
    HBITMAP hbmp;
    if ((himl = ImageList_Create(16, 16, FALSE, 1, 0)) == NULL) {
        RUN_HERE() << GetErrorMessage();
        return;
    }
    hbmp = (HBITMAP)LoadImage(GetCurrentInstance(), TEXT("p.bmp"), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
    if (hbmp == NULL) {
        RUN_HERE() << GetErrorMessage();
        return;
    }
    m_image = ImageList_Add(himl, hbmp, (HBITMAP)NULL);
    m_image = ImageList_Add(himl, hbmp, (HBITMAP)NULL);
    DeleteObject(hbmp);
    SendMessage(TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)himl);

}
void CCTNodeWin::OnCreate()
{
    InitImageLists();
    HTREEITEM   hti;
    hti = AddItemToTree(TEXT("Node1"), 1, m_image);
    RUN_HERE() << "hti = " << hti;
    RUN_HERE() << GetErrorMessage();
    hti = AddItemToTree(TEXT("Node2"), 2, m_image);
    RUN_HERE() << "hti = " << hti;
    hti = AddItemToTree(TEXT("Node3"), 3, m_image);
    RUN_HERE() << "hti = " << hti;
    AddItemToTree(TEXT("Node4"), 3, m_image);
    AddItemToTree(TEXT("Node5"), 2, m_image);
    AddItemToTree(TEXT("Node6"), 2, m_image);
    AddItemToTree(TEXT("Node7"), 3, m_image);
    AddItemToTree(TEXT("Node8"), 2, m_image);
}



